home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Unmangler.p < prev    next >
Encoding:
Text File  |  1994-07-27  |  2.7 KB  |  71 lines  |  [TEXT/MPS ]

  1. (*---------------------------------------------------------------------------*
  2.  |                                                                           |
  3.  |                            <<< Unmangler.p >>>                            |
  4.  |                                                                           |
  5.  |                         C++ Function Name Decoding                        |
  6.  |                                                                           |
  7.  |                 Copyright Apple Computer, Inc. 1988-1991                  |
  8.  |                           All rights reserved.                            |
  9.  |                                                                           |
  10.  *---------------------------------------------------------------------------*)
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17. UNIT Unmangler;
  18.  INTERFACE
  19. {$ENDC}
  20.         
  21. {$IFC UNDEFINED UsingUnmangler AND UNDEFINED __UNMANGLER__}
  22. {$SETC UsingUnmangler := 1}
  23. {$SETC __UNMANGLER__ := 1}
  24. {$I+}
  25. {$SETC UnmanglerIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27.  
  28. {$IFC UNDEFINED UsingTypes AND UNDEFINED __TYPES__}
  29. {$I Types.p}
  30. {$ENDC}
  31.  
  32. {$SETC UsingIncludes := UnmanglerIncludes}
  33.  
  34.         (*
  35.         FUNCTION unmangle(dst: UNIV Ptr; src: UNIV Ptr; limit: LongInt): LongInt; C;
  36.             {This function unmangles C++ mangled symbols (i.e. a symbol with a type signature).
  37.              The mangled C string is passed in “src” and the unmangled C string is returned in
  38.              “dst”.  Up to “limit” characters (not including terminating null) may be retured
  39.              in “dst”.
  40.          
  41.              The function returns,
  42.          
  43.                  -1 ==> error, probably because symbol was not mangled, but looked like it was
  44.                     0 ==> symbol wasn't mangled; not copied either
  45.                     1 ==> symbol was mangled; unmangled result fit in buffer
  46.                     2 ==> symbol was mangled; unmangled result truncated to fit in buffer}
  47.         *)
  48.         
  49.         FUNCTION Unmangle(dst: UNIV StringPtr; src: UNIV StringPtr; limit: LongInt): LongInt;
  50.             {This function unmangles C++ mangled symbols (i.e. a symbol with a type signature).
  51.              The mangled Pascal string is passed in “src” and the unmangled Pascal string is
  52.              returned in “dst”.  Up to “limit” characters may be retured in “dst”.
  53.             
  54.              The function returns,
  55.              
  56.                  -1 ==> error, probably because symbol was not mangled, but looked like it was
  57.                     0 ==> symbol wasn't mangled; not copied either
  58.                     1 ==> symbol was mangled; unmangled result fit in buffer
  59.                     2 ==> symbol was mangled; unmangled result truncated to fit in buffer
  60.                      
  61.              This function is identical to unmangle() above except that all the strings are
  62.              Pascal instead of C strings.
  63.             }
  64.  
  65. {$ENDC} { UsingUnmangler }
  66.  
  67. {$IFC NOT UsingIncludes}
  68.  END.
  69. {$ENDC}
  70.  
  71.